author = "Peter J Usherwood"
Sample use case for transforming a standard coded taxanomy into a bycat form
In [1]:
import pandas as pd
import numpy as np
import csv
from main.tools.create_df import DF
from main.taxanomy.bycat import domains_to_binary, encoded_to_bycat_counts, bycat_counts_to_bycat_scores
In [9]:
df = DF([{'type': 'Binary', 'name': 'Tax', 'n_itters': 3, 'args': {'perc_ones':.45}},
{'type': 'Binary', 'name': 'Cross Moment', 'n_itters': 3, 'args': {'perc_ones':.45}},
{'type': 'Binary', 'name': 'Cross Brand', 'n_itters': 3, 'args': {'perc_ones':.45}},
{'type': 'Number', 'name': 'Cross Sentiment', 'n_itters': 1, 'args': {}}],
n_records=10)
In [10]:
df
Out[10]:
In [11]:
bycat = encoded_to_bycat_counts(df_encoded=df, tax_col_indicator='Tax', cross_col_indicator='Cross')
bycat
Out[11]:
In [ ]: